import request from '@utils/request'

//获取部门名称
export function getDepartmentName (data) {
  return request({
    url: '/department/getDeptList',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 查询部门信息
export function getDepartmentList (data) {
  return request({
    url: '/department/getPageList',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 新增部门信息
export function addDepartment (data) {
  return request({
    url: '/department/save',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 修改部门信息
export function updateDepartment (data) {
  return request({
    url: '/department/update',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 删除部门信息
export function deleteDepartment (data) {
  return request({
    url: '/department/delete',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}